package com.fc.enums;

import lombok.Getter;

@Getter
public enum CargoType implements IEnum{
    EMPTY(1, "空箱"),
    FULL(2, "产品");


    private final int code;
    private final String description;

    CargoType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static CargoType fromCode(int code) {
        for (CargoType status : CargoType.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("状态异常: " + code);
    }
}
